home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / adduser.postinst < prev    next >
Text File  |  2009-08-03  |  958b  |  37 lines

  1. #!/bin/sh -e
  2.  
  3. # create an initial adduser configfile if it does not exist yet
  4. if [ ! -e "/etc/adduser.conf" ]; then
  5.     cp /usr/share/adduser/adduser.conf /etc/adduser.conf
  6. fi
  7.  
  8. # modify adduser.conf
  9. if . /usr/share/debconf/confmodule
  10. then    
  11.     db_get adduser/homedir-changed || RET="false"
  12.     if [ "$RET" != "true" ]
  13.     then
  14.         db_get adduser/homedir-permission || RET="true"
  15.         if [ "$RET" = "false" ]
  16.         then
  17.             NEW_PERMISSION="0751"
  18.         else
  19.             NEW_PERMISSION="0755"
  20.         fi
  21.  
  22.         if grep -q '^DIR_MODE=' /etc/adduser.conf
  23.         then
  24.             OLD_PERMISSION=$(cat /etc/adduser.conf|sed -ne 's/^DIR_MODE=\([0-9]*\).*$/\1/p')
  25.             if [ "$OLD_PERMISSION" != "$NEW_PERMISSION" ]; then
  26.                 mv /etc/adduser.conf /etc/adduser.conf.dpkg-save
  27.                 cat /etc/adduser.conf.dpkg-save | \
  28.                 sed -e "s/^DIR_MODE=.*$/DIR_MODE=$NEW_PERMISSION/" > \
  29.                 /etc/adduser.conf
  30.             fi
  31.         else
  32.             cp /etc/adduser.conf /etc/adduser.conf.dpkg-save
  33.             echo "DIR_MODE=$NEW_PERMISSION" >> /etc/adduser.conf
  34.         fi
  35.     fi
  36. fi
  37.